package com.kede.app.domain;

import lombok.Data;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.io.Serializable;

/**
* @description /
* @author Pr.li
* @date 2023-06-17
**/
@Entity
@Data
@Table(name="sy_unishop_product")
public class UnishopProduct implements Serializable {
    /**
    * 
    */
    @ApiModelProperty(value = "id")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    private Integer id;
    /**
    * 分类ID
    */
    @ApiModelProperty(value = "分类ID")
    @Column(name = "`category_id`")
    private Integer categoryId;
    /**
    * 产品标题
    */
    @ApiModelProperty(value = "产品标题")
    @Column(name = "`title`",nullable = false)
    @NotBlank
    private String title;
    /**
    * 主图
    */
    @ApiModelProperty(value = "主图")
    @Column(name = "`image`")
    private String image;
    /**
    * 组图
    */
    @ApiModelProperty(value = "组图")
    @Column(name = "`images`")
    private String images;
    /**
    * 详情
    */
    @ApiModelProperty(value = "详情")
    @Column(name = "`desc`")
    private String desc;
    /**
    * 市场价
    */
    @ApiModelProperty(value = "市场价")
    @Column(name = "`market_price`")
    private BigDecimal marketPrice;
    /**
    * 销售价
    */
    @ApiModelProperty(value = "销售价")
    @Column(name = "`sales_price`")
    private BigDecimal salesPrice;
    /**
    * 销售量
    */
    @ApiModelProperty(value = "销售量")
    @Column(name = "`sales`")
    private Integer sales;
    /**
    * 库存
    */
    @ApiModelProperty(value = "库存")
    @Column(name = "`stock`")
    private Integer stock;
    /**
    * 浏览量
    */
    @ApiModelProperty(value = "浏览量")
    @Column(name = "`look`")
    private Integer look;
    /**
    * 已下单但是未付款量
    */
    @ApiModelProperty(value = "已下单但是未付款量")
    @Column(name = "`no_buy_yet`")
    private Integer noBuyYet;
    /**
    * 是否使用规格
    */
    @ApiModelProperty(value = "是否使用规格")
    @Column(name = "`use_spec`")
    private Integer useSpec;
    /**
    * 规格属性
    */
    @ApiModelProperty(value = "规格属性")
    @Column(name = "`specList`")
    private String speclist;
    /**
    * 规格值
    */
    @ApiModelProperty(value = "规格值")
    @Column(name = "`specTableList`")
    private String spectablelist;
    /**
    * 权重
    */
    @ApiModelProperty(value = "权重")
    @Column(name = "`weigh`",nullable = false)
    @NotNull
    private Integer weigh;
    /**
    * 运费模板
    */
    @ApiModelProperty(value = "运费模板")
    @Column(name = "`delivery_id`")
    private Integer deliveryId;
    /**
    * 真实销量
    */
    @ApiModelProperty(value = "真实销量")
    @Column(name = "`real_sales`")
    private Integer realSales;
    /**
    * 真实浏览量
    */
    @ApiModelProperty(value = "真实浏览量")
    @Column(name = "`real_look`")
    private Integer realLook;
    /**
    * 是否上架:0=否,1=是
    */
    @ApiModelProperty(value = "是否上架:0=否,1=是")
    @Column(name = "`switch`",nullable = false)
    @NotNull
    private Integer switchStatus;
    /**
    * 服务
    */
    @ApiModelProperty(value = "服务")
    @Column(name = "`server`")
    private String server;
    /**
    * 更新时间
    */
    @ApiModelProperty(value = "更新时间")
    @Column(name = "`updatetime`")
    private Integer updatetime;
    /**
    * 创建时间
    */
    @ApiModelProperty(value = "创建时间")
    @Column(name = "`createtime`")
    private Integer createtime;
    /**
    * 删除时间
    */
    @ApiModelProperty(value = "删除时间")
    @Column(name = "`deletetime`")
    private Integer deletetime;

    public void copy(UnishopProduct source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
